/*
 * @Author: qq_48652goq qq_48652goq@noreply.gitcode.com
 * @Date: 2025-06-19 20:33:00
 * @LastEditors: qq_48652goq qq_48652goq@noreply.gitcode.com
 * @LastEditTime: 2025-06-19 21:26:40
 * @FilePath: /payment-application/src/api/modules/user.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { ResPage, User } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

/**
 * @name
 */
// 获取用户列表
export const getUserList = (params: User.ReqUserParams) => {
  return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/list`, params);
};
// 获取承包商列表
export const getUserListchenbao = (params: User.ReqUserParams) => {
  return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/listchenbao`, params);
};
// 获取承包商列表
export const getUserListkaihu = (params: User.ReqUserParams) => {
  return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/listkaihu`, params);
};

// 获取树形用户列表
export const getUserTreeList = (params: User.ReqUserParams) => {
  // 发送HTTP POST请求到指定的URL，获取用户树列表
  return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/tree/list`, params);
};

// 新增用户
export const addUser = (params: { id: string }) => {
  return http.post(PORT1 + `/user/add`, params);
};
// 新增承包商
export const addChenBao = (params: { id: string }) => {
  return http.post(PORT1 + `/user/addchenbao`, params);
};
// 新增开户行
export const addKaiHu = (params: { id: string }) => {
  return http.post(PORT1 + `/user/addkaihu`, params);
};

// 批量添加用户
export const BatchAddUser = (params: FormData) => {
  return http.post(PORT1 + `/excel/import`, params);
};
// 批量添加供应商
export const BatchAddUserGong = (params: FormData) => {
  return http.post(PORT1 + `/excel/importgong`, params);
};

// 编辑用户
export const editUser = (params: { id: string }) => {
  return http.post(PORT1 + `/user/edit`, params);
};

// 编辑承包商
export const editChenBao = (params: { id: string }) => {
  return http.post(PORT1 + `/user/editchenbao`, params);
};
// 编辑开户行
export const editKaiHu = (params: { id: string }) => {
  return http.post(PORT1 + `/user/editkaihu`, params);
};
// 获取点击数
export const getCountryList = (params: { type: string }) => {
  return http.post(PORT1 + `/user/getconlist`, params);
};
// 获取点击数
export const setCountryList = (params: { type: string }) => {
  return http.post(PORT1 + `/user/addNumber`, params);
};
export const selectData = (params: { type: string }) => {
  return http.post(PORT1 + `/user/selectData`, params, { loading: false });
};

// 删除用户
export const deleteUser = (params: { id: string[] }) => {
  return http.post(PORT1 + `/user/delete`, params);
};

// 删除承包商
export const deleteChenBao = (params: { id: string[] }) => {
  return http.post(PORT1 + `/user/deletechenbao`, params);
};
// 删除开户行
export const deleteKaiHu = (params: { id: string[] }) => {
  return http.post(PORT1 + `/user/deletekaihu`, params);
};

// 切换用户状态
export const changeUserStatus = (params: { id: string; status: number }) => {
  return http.post(PORT1 + `/user/change`, params);
};

// 重置用户密码
export const resetUserPassWord = (params: { id: string }) => {
  return http.post(PORT1 + `/user/rest_password`, params);
};

// 导出用户数据
export const exportUserInfo = (params: User.ReqUserParams) => {
  return http.download(PORT1 + `/excel/export`, params);
};
// 导出供应商数据
export const exportUserInfoGong = (params: User.ReqUserParams) => {
  return http.download(PORT1 + `/excel/exporthezuo`, params);
};

// 获取用户状态字典
export const getUserStatus = () => {
  return http.get<User.ResStatus[]>(PORT1 + `/user/status`);
};

// 获取用户性别字典
export const getUserGender = () => {
  return http.get<User.ResGender[]>(PORT1 + `/user/gender`);
};
// 获取用户开户类型字典
export const kaihuTypeApi = () => {
  return http.get<User.ResGender[]>(PORT1 + `/user/kaihuType`);
};

// 获取用户部门列表
export const getUserDepartment = () => {
  return http.get<User.ResDepartment[]>(PORT1 + `/user/department`, {}, { cancel: false });
};

// 获取用户角色字典
export const getUserRole = () => {
  return http.get<User.ResRole[]>(PORT1 + `/user/role`);
};
